package com.happly.happlycloud.dao;

import com.happly.happlycloud.pojo.Product;
import com.happly.happlycloud.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ProductMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Product record);

    int insertSelective(Product record);

    Product selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Product record);

    int updateByPrimaryKey(Product record);

    List<Product> selectList();

    List<Product> selectByNameAndProductId(@Param("productName")String productName,@Param("productId") Integer productId);

    List<Product> selectByNameAndCategoryIds(@Param("productName")String productName,@Param("categoryIdList")List<Integer> categoryIdList);


    User selectByPrimaryKeyUser(Integer productId);

    User selectByUserInfo(Integer productId);

    Product selectByUserIdPrimaryKey(Integer productId);

    List<Product> getProductList(Integer tutorId);

    int checkTutorExist(Integer tutorId);

    //这里一定要用Integer，因为int无法为null，考虑到很多商品已经删除的情况。
    Integer selectStockByProductId(Integer id);
}